<?php
	$mode=$_GET['mode'];
	$obj=new ObjRequest();
	$obj->RequestID=$_POST['RequestID'];
	$obj->Title=$_POST['Title'];
	$obj->Detail=$_POST['Detail'];
	$obj->ResponseBy=$_SESSION['username'];
	$obj->ResponseDate=$dt->_getNow("-");;
	$obj->ResolveBy="";
	$obj->ResolveDate="";
	$obj->Status=0;
	
	
	if($mode=="add" && $obj->Title!="" && $obj->Detail!="")
	{
		$obj->insert($conn);
		if(count($_POST['Rows'])>0)
			foreach($_POST['Rows'] as $key =>$val)
			{
				$file=new ObjFile();
				$file->insert($conn,'subimageRow'.$key);
				$obj->insertAttachment($conn,$file->FileID);
			}
	}
	if($mode=="update")
	{
		$obj->update($conn);
	}
	if($mode=="del")
	{
		$obj->RequestID=$id;
		$obj->delete($conn);
	}
	$url="?module=$module";
	echo "<script language='JavaScript'> window.location = '".$url."'</script>";
?>